import Vue from "vue";
import VueRouter from "vue-router";
import routes from "./routes";
Vue.use(VueRouter);

const originPush = VueRouter.prototype.push;
const originReplace = VueRouter.prototype.replace;

VueRouter.prototype.push = function (a, b, c) {
    if (b === undefined && c === undefined) {
        return originPush.call(this, a).catch(() => { })
    } else {
        return originPush.call(this, a, b, c);
    }
};
VueRouter.prototype.replace = function (a, b, c) {
    if (b === undefined && c === undefined) {
        return originReplace.call(this, a).catch(() => { })
    } else {
        return originReplace.call(this, a, b, c);
    }
}

export default new VueRouter({
    routes,
})